var app = getApp();
var util = require('../../utils/util')
    //Page Object
Page({
    data: {
        systemInfo: app.systemInfo,
        workList: [
            { 'name': 'windows图片查看器官方版软件下载图片查看器免费正式版', 'src': '../../image/timg.jpg', 'datatime': '2019-01-29 18:45:27', 'type': '会员文章' },
            { 'name': 'windows图片查看器官方版软件下载图片查看器免费正式版', 'src': '../../image/timg.jpg', 'datatime': '2019-01-29 18:45:27', 'type': '会员文章' },
            { 'name': 'windows图片查看器官方版软件下载图片查看器免费正式版', 'src': '../../image/timg.jpg', 'datatime': '2019-01-29 18:45:27', 'type': '会员文章' },
            { 'name': 'windows图片查看器官方版软件下载图片查看器免费正式版', 'src': '../../image/timg.jpg', 'datatime': '2019-01-29 18:45:27', 'type': '会员文章' },
            { 'name': 'windows图片查看器官方版软件下载图片查看器免费正式版', 'src': '../../image/timg.jpg', 'datatime': '2019-01-29 18:45:27', 'type': '会员文章' },
        ],
        imgurl: '',
        id: ''
    },
    getImg: function() {
        let _self = this
        util.postRequest('FinanceManage/rest/paramConduct.do', { openId: app.openId, type: '3' }, function(res) {
            console.log(res)
            _self.setData({
                imgurl: res.pic_url
            })
        })
    },
    goto: function(e) {
        console.log(e.currentTarget.dataset.id)
        let pageId = e.currentTarget.dataset.id
        wx.navigateTo({
            url: '/pages/details/index?pageId=' + pageId
        });
    },
    getClassList(id) {
        let _self = this
        let data = {
            openId: app.openId,
            type_id: id
        }
        util.postRequest('FinanceManage/rest/articleList.do', data, function(res) {
            console.log(res)
            _self.setData({
                workList: res.articleList
            })
        })

    },
    //options(Object)
    onLoad: function(options) {
        console.log(options.classId)
        this.setData({
            id: options.classId
        })
    },
    onReady: function() {

    },
    onShow: function() {
        this.getClassList(this.data.id)
        this.getImg()
    },
    onHide: function() {

    },
    onUnload: function() {

    },
    onPullDownRefresh: function() {

    },
    onReachBottom: function() {

    },
    onShareAppMessage: function() {

    },
    onPageScroll: function() {

    },
    //item(index,pagePath,text)
    onTabItemTap: function(item) {

    }
});